<%@ page import="java.io.*, java.text.*, java.util.Date, java.sql.*, javax.servlet.*, javax.servlet.http.*, java.util.*" %>
<%

Enumeration projects = request.getParameterNames();
ArrayList id = new ArrayList();
while(projects.hasMoreElements())
{
	id.add(projects.nextElement());
}

String [] type = new String[id.size()];

for(int i=0;i<id.size();i++)
{
	type[i] = request.getParameter((String)id.get(i));
}

String driver ="com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/projects";
String username = "ia";
String password = "123";
try
{
	Class.forName(driver).newInstance();
	Connection connection = DriverManager.getConnection(url, username, password);
	for(int i=0;i<id.size();i++)
	{
		Statement statement = connection.createStatement();
		String query = "update user_log_in set type = '"+type[i]+"' where id = "+(String)id.get(i);
		statement.executeUpdate(query);
	}
	response.sendRedirect("controlType.jsp");
	connection.close();
	
	
		
}catch(ClassNotFoundException cnfe)
{
		out.println("<br>Couldn't find class file" + cnfe); 
}catch(SQLException sqle)
{
		out.println("<br>SQL Exception: " + sqle);
}catch(InstantiationException ie)
{
		out.println("<br>Instant exception : " + ie);
}catch(IllegalAccessException iae)
{
		out.println("<br>Illegal access exception : " + iae);
		
}
%>